package com.hmall.es.config;

import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 注册restHighLevelClient到IOC容器中  ,es的配置
 */
@Configuration
public class RestHighLevelClientConfig {

    @Bean
    public RestHighLevelClient restClient(){
        RestHighLevelClient client = new RestHighLevelClient(
                RestClient.builder(HttpHost.create("http://192.168.168.138:9200"))
        );
        return client;
    }
}